<%@ taglib uri="/linuxbox/common.tld" prefix="common" %>

  <table width="100%" CELLPADDING="0" CELLSPACING="1" BORDER="0" bgColor=#dddddd >
<%
  Iterator it = null;
  if (RESOURCECATID == -1 && RESOURCEID == -1)
    it = home.getAllEntries(currentDate, curUserID, VIEW_MINE!=0, SORTBY, sortAsc);
  else if ( RESOURCECATID != -1 )
    it = home.getEntriesByCat(currentDate, curUserID, VIEW_MINE!=0, RESOURCECATID, SORTBY, sortAsc);
  else
    it = home.getEntries(currentDate, curUserID, VIEW_MINE!=0, RESOURCEID, SORTBY, sortAsc);

  String resvAction = BoxStatic.servletDir+"BoxReservationViewAction";

  if ( it != null && it.hasNext())
  {
    int count = 0;
%>
    <tr bgcolor=#7EC1F3>
      <%
        String[] headers = {"Subject", "Resource", "From Time -- To Time", "Reserved By", "Delete"};
        String[] sortby = {"subject", "resourceid", "fromtime", "reservedby", ""};
      %>
      <common:ListHeader headers="<%=headers%>" sortby="<%=sortby%>" curSortBy="<%=SORTBY%>" sortAsc="<%=sortAsc%>" action="<%=resvAction%>" />
    </TR>
    <Common:Iteration name="entry" type="BoxReservationEntry" group="<%=it%>">
      <tr <% if ((count++ % 2) == 0) out.print("bgcolor=#f0f0f0"); %>>
        <td><a href="<%=BoxStatic.servletDir%>BoxReservationAction?SubmitEdit=edit&ID=<%=entry.getID()%>"><%=entry.getSubject()%></a>
         <% if (entry.getRepeat())
            { %>
            &nbsp;<IMG SRC="<%=BoxStatic.imageDir%>cal_repeat.gif" WIDTH=13 HEIGHT=12 BORDER=0 >
            <%}%>
        </td>
        <td><a href="<%=BoxStatic.servletDir%>BoxResourceAction?SubmitView=view&ID=<%=entry.getResourceID()%>"><%=home.getResourceString(entry.getResourceID())%></a></td>
        <td><%=entry.getTimeRangeString(sec.getTimeZone())%></td>
        <td><%=entry.getUserID()%></td>
        <td><% if (isAdminUser || curUserID.compareTo(entry.getUserID())==0 )
               {
            %>
            <a href="<%=BoxStatic.servletDir%>BoxReservationAction?SubmitDelete=del&ID=<%=entry.getID()%>"
          Onclick='return confirmDel("<%=entry.getSubject()%>")'
          >Delete</a>
          <%}
            else
              out.print("&nbsp;");
          %>
        </td>
      </tr>
    </Common:Iteration>
<%
  }
  else
    out.print("<tr><td align=center><font size=\"+2\">No reservations for today. </font></td></tr>");
%>
  </table>
